<!DOCTYPE html >
<html>
<head>
<meta name="Generator" content="tpshop" />
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width">
<title>用户注册-{$tpshop_config['shop_info_store_title']}</title>
<meta http-equiv="keywords" content="{$tpshop_config['shop_info_store_keyword']}" />
<meta name="description" content="{$tpshop_config['shop_info_store_desc']}" />

<meta name="viewport" content="initial-scale=1.0, maximum-scale=1.0, user-scalable=0"/>
<link rel="stylesheet" type="text/css" href="__STATIC__/css/public.css"/>
<link rel="stylesheet" type="text/css" href="__STATIC__/css/login.css"/>  
<script type="text/javascript" src="__STATIC__/js/jquery.js"></script>
<script type="text/javascript" src="__STATIC__/js/layer.js" ></script>
<script src="__PUBLIC__/js/global.js"></script>
<script src="__PUBLIC__/js/mobile_common.js"></script>
</head>
<body>
<header id="header" class='header'>
	<div class="h-left"><a href="javascript:history.back(-1)" class="back"></a></div>
    <div class="h-mid"><img src="__STATIC__/images/toplogo.png">用户注册</div>
</header>
<div id="tbh5v0">
	<div class="log_reg_box">
		<!-- <ul class="tab" id="logRegTab">
			<li id="mob_log" class="curr" onClick="changeForm(this)">
				<span>
					<font>手机注册</font>
				</span>
			</li>
			<li id="email_log" class="curr currr" onClick="changeForm(this)">
				<span>
					<font>邮箱注册</font>
				</span>
			</li>
		</ul> -->
		<div id="logRegTabCon">
			<div class="log_reg_item" id="phonearea">
				<form action="{:U('Mobile/User/reg')}" id="mobileForm" name="mobileForm" method="post"  onsubmit="return check_submit()">
						<div class="yanzheng"  style=" margin-top:0px;">
							<div class="field phone">
								<span class="dt">推荐人帐号：</span>
	                        </div>
                            <div class="codeTxt" style="margin-bottom:5px;">
								<input type="text" name="tjr_accname" id="tjr_accname" value="{$uname}" />
                             </div>
                               
						</div>

						<div class="yanzheng"  style=" margin-top:0px;">
							<div class="field phone">
								<span class="dt">帐号:</span>
	                        </div>
                           
                             <div class="codeTxt" style="margin-bottom:5px;">
                                    <input type="text" placeholder="请输入由英文字母和数字组成的帐号"
                                           value="{$rand_account}"
                                           name="account" id="account" required/> 
                                   
                                </div>
                               <a href="" style="color: red">换一个</a>
						</div>

						

						<div class="field phone">
							<span class="dt">手机号:</span>
							<input type="text" id="username" name="username" placeholder="请输入手机号" class="c-form-txt-normal"  />
								<span id="mobile_phone_notice"></span>
						</div>
						 <if condition="$reg['reg_bt_1'] eq 1">
						<div class="field phone">
							<span class="dt">姓名:</span>
							<input type="text" id="bank_name" name="bank_name" placeholder="提交后不可更改，请准确核实" class="c-form-txt-normal"  />
								<span id="truename_notice"></span>
						</div>
						</if>
						 <if condition="$reg['is_reg_card_statu'] eq 1">
						<div class="field phone">
							<span class="dt">身份证号:</span>
							<input type="text" id="id_card" name="card" placeholder="提交后不可更改，请准确核实" class="c-form-txt-normal"  />
								<span id="id_card_notice"></span>
						</div>
						  </if>
						<div class="field pwd">
						<span class="dt">登录密码:</span>
							<input type="password" id="password" name="password" value="888888" placeholder="登录密码" class="c-form-txt-normal" onBlur="check_password(this.value);" />
								<div class="tips">
									<span id="password_notice">&nbsp;&nbsp;&nbsp;黙认登录密码：888888</span>
								</div>
						</div>
						<div class="field pwd">
						<span class="dt">确认登录密码:</span>
							<input type="password" id="password2" name="password2" value="888888" placeholder="确认登录密码" class="c-form-txt-normal" onBlur="check_confirm_password(this.value);" value="888888" />
								<div class="tips">
								<span id="confirm_password_notice">&nbsp;&nbsp;&nbsp;黙认登录密码：888888</span>
								</div>
						</div>
						<div class="field pwd">
						<span class="dt">交易密码:</span>
							<input type="password" id="secpwd" name="secpwd" value="999999" placeholder="交易密码" class="c-form-txt-normal" onBlur="check_secpwd(this.value);" />
							<div class="tips">
								<span id="secpwd_notice">&nbsp;&nbsp;&nbsp;黙认交易密码：999999</span>
							</div>
						</div>
						<div class="field pwd">
						<span class="dt">确认交易密码:</span>
							<input type="password" id="secpwd2" name="secpwd2" value="999999" placeholder="确认交易密码" class="c-form-txt-normal" onBlur="check_confirm_secpwd(this.value);" />
							<div class="tips">
								<span id="confirm_secpwd_notice">&nbsp;&nbsp;&nbsp;黙认交易密码：999999</span>
							</div>
						</div>

						<div class="yanzheng"  style=" margin-top:0px;">
						<span class="dt">会员级别:</span>
						      <select class="inp imgcode J_imgcode slstyle" id="level" name="level" style="width:310px; height:30px;">
                                        <option value="1">请选择</option>
                                        <option value="1">免费会员</option>
                                        <option value="2">vip会员</option>
                                    </select>
						</div>
						<div class="yanzheng">
                                <label class="linel" style="width:100px;"><span class="dt">联系地址：</span></label>
                                <div class="liner">
                                    <select class="inp imgcode J_imgcode slstyle" name="province" id="province"
                                            onChange="get_city(this)" style="height:30px;">
                                        <option value="0">请选择</option>
                                        <volist name="province" id="p">
                                            <option value="{$p.id}">{$p.name}</option>
                                        </volist>
                                    </select>

                                    <select class="inp imgcode J_imgcode slstyle" name="city" id="city"
                                            onChange="get_area(this)" style="height:30px;">
                                        <option value="0">请选择</option>
                                        <volist name="city" id="p">
                                            <option value="{$p.id}">{$p.name}</option>
                                        </volist>
                                    </select>

                                    <select class="inp imgcode J_imgcode slstyle" name="district" id="district"
                                            onChange="get_twon(this)" style="height:30px;">
                                        <option value="0">请选择</option>
                                        <volist name="district" id="p">
                                            <option value="{$p.id}">{$p.name}</option>
                                        </volist>
                                    </select>

                                    <!-- <select class="inp imgcode J_imgcode slstyle" style="display:none;" name="twon"
                                            id="twon">
                                        <volist name="twon" id="p">
                                            <option value="{$p.id}">{$p.name}</option>
                                        </volist>
                                    </select>
                                    <br> -->
                                </div>
                            </div>
						


						<input type="submit" id="btn_submit" name="Submit" class="btn_big1" value="注 册" />
			</form>
			</div>
			<!-- <div class="log_reg_item hide" id="emailarea">
				<form action="" method="post" id="emailForm" name="emailForm" onSubmit="return check_submit()">
					<div class="field email">
							<div class="st">
								<input type="email" name="username" placeholder="邮箱地址" value="" class="c-form-txt-normal" id="username" onBlur="checkEmail2(this.value);" />
							</div>
							<div class="tips">
								<span id="email_notice"></span>
							</div>
						</div>
						<div class="field pwd">
							<div>
								<input type="password" name="password" id="password" onBlur="check_password(this.value);" value="" placeholder="密码" class="c-form-txt-normal" />
							</div>
							<div class="tips">
								<span id="password_notice"> </span>
							</div>
						</div>
						<div class="field pwd">
							<div>
								<input type="password" name="password2" id="password2" onBlur="check_confirm_password(this.value);" value="" placeholder="确认密码" class="c-form-txt-normal">
							</div>
							<div class="tips">
								<span id="confirm_password_notice"> </span>
							</div>
						</div>
						<div class="yanzheng" style=" margin-top:0px;">
			                              <div class="codeTxt">
								<input type="text" id="email_code" name="email_code"  placeholder="邮箱验证码"/></div>
			                                   <div class="codePhoto">
									<input id="zemail" type="button" rel="email" value="获取邮箱验证码 " class="zphone" onClick="sendcode(this)" style=" color:#FFF">
			                                  </div>
						</div>													
						<input type="checkbox" style="display: none" name="agreement" value="1" checked="checked" required />
						<input type="submit" id="btn_submit" name="Submit" class="btn_big1" value="注 册" />
				</form>
			</div> -->
		</div>
	</div>			
<include file="Public/footer"/>			
</div>
<script type="text/javascript">

setCurrentForm($("#mobileForm"));
var flag = false;

function changeForm(obj){
	$(obj).removeClass('currr');
	$(obj).siblings().addClass('currr');
	if($(obj).attr('id')=='mob_log'){
		$('#phonearea').show();
		setCurrentForm($("#mobileForm"))
		$('#emailarea').hide();
	}else{
		$('#phonearea').hide();
		setCurrentForm($("#emailForm"))
		$('#emailarea').show();
	}
}

function setCurrentForm(formObj) {
	currentForm = $(formObj);
}

function checkEmail2(email){
	if(email == ''){
		$('#email_notice').css('color','red');
		$('#email_notice').html('* 邮件地址不能为空');
		flag = false;
	}else if(checkEmail(email)){
		$('#email_notice').css('color','green');
		$('#email_notice').html('* 可以注册');
		flag = true;
	}else{
		$('#email_notice').css('color','red');
		$('#email_notice').html('* 邮件地址不正确');
		flag = false;
	}
}


function checkMobilePhone(mobile){
	if(mobile == ''){
		$('#mobile_phone_notice').css('color','red');
		$('#mobile_phone_notice').html('* 手机号码不能为空');
		flag = false;
	}else if(checkMobile(mobile)){
		
	$.ajax({
			type : "GET",			
			url:"/index.php?m=Home&c=Api&a=issetMobile",//+tab,
//			url:"{:U('Mobile/User/comment',array('status'=>$_GET['status']),'')}/is_ajax/1/p/"+page,//+tab,
			data :{mobile:mobile},// 你的formid 搜索表单 序列化提交
			success: function(data)
			{
				if(data == '0')
				{
					$('#mobile_phone_notice').css('color','green');
					$('#mobile_phone_notice').html('* 可以注册');
					flag = true;					
				}else{
					$('#mobile_phone_notice').css('color','red');
					$('#mobile_phone_notice').html('* 手机号已存在');
					flag = false;
				}
			}
		});		
	}else{
		$('#mobile_phone_notice').css('color','red');
		$('#mobile_phone_notice').html('* 手机号码格式不正确');
		flag = false;
	}
}


function check_password(password) {
	if (password.indexOf(" ") != -1) {
		$(currentForm).find('#password_notice').css('color','red').html("登录密码不能包含空格");
		flag = false;
	} else if (password.length < 6) {
		$(currentForm).find('#password_notice').css('color','red').html('- 登录密码不能少于 6 个字符。');
		flag = false;
	} else {
		$(currentForm).find('#password_notice').css('color','green').html('可以注册');
		flag = true;
	}
}


function check_secpwd(password) {
	if (password.indexOf(" ") != -1) {
		$(currentForm).find('#secpwd_notice').css('color','red').html("登录密码不能包含空格");
		flag = false;
	} else if (password.length < 6) {
		$(currentForm).find('#secpwd_notice').css('color','red').html('- 登录密码不能少于 6 个字符。');
		flag = false;
	} else {
		$(currentForm).find('#secpwd_notice').css('color','green').html('可以注册');
		flag = true;
	}
}



function check_confirm_password(confirm_password) {
	var password = $(currentForm).find('#password').val();
	if (password.indexOf(" ") != -1) {
		$(currentForm).find('#confirm_password_notice').css('color','red').html("确认密码不能包含空格");
		flag = false;
		return false;
	}
	if (confirm_password.length < 6) {
		$(currentForm).find('#confirm_password_notice').css('color','red').html('- 登录密码不能少于 6 个字符。');
		flag = false;
		return false;
	}
	if (confirm_password != password) {
		$(currentForm).find('#confirm_password_notice').css('color','red').html('两次密码不一致');
		flag = false;
	} else {
		$(currentForm).find('#confirm_password_notice').css('color','green').html('可以注册');
		flag = true;
	}
}



function check_confirm_password(confirm_password) {
	var password = $(currentForm).find('#password').val();
	if (password.indexOf(" ") != -1) {
		$(currentForm).find('#confirm_password_notice').css('color','red').html("确认密码不能包含空格");
		flag = false;
		return false;
	}
	if (confirm_password.length < 6) {
		$(currentForm).find('#confirm_password_notice').css('color','red').html('- 登录密码不能少于 6 个字符。');
		flag = false;
		return false;
	}
	if (confirm_password != password) {
		$(currentForm).find('#confirm_password_notice').css('color','red').html('两次密码不一致');
		flag = false;
	} else {
		$(currentForm).find('#confirm_password_notice').css('color','green').html('可以注册');
		flag = true;
	}
}


function check_submit()
{ 
	var username = $.trim($(currentForm).find('#username').val());
	var password = $(currentForm).find('#password').val();
	var password2= $(currentForm).find('#password2').val();		
	if(username.length >0 && password.length > 0 && password2.length > 0 && flag)	
	{
		return true;
	} else{
		return false;	
	}
		 
}

function sendcode(o){
	$.ajax({
		url:'/index.php?m=Mobile&c=User&a=send_validate_code&t='+Math.random(),
		type:'post',
		dataType:'json',
		data:{type:$(o).attr('rel'),send:$.trim($(currentForm).find('#username').val())},
		success:function(res){
			if(res.status==1){
				countdown(o);
			}else{
				layer.open({content:res.msg,time:2});
			}
		}
	})
}

var wait = 150;
function countdown(obj, msg) {
	obj = $(obj);
	if (wait == 0) {
		obj.removeAttr("disabled");
		obj.val(msg);
		wait = 150;
	} else {
		if (msg == undefined || msg == null) {
			msg = obj.val();
		}
		obj.attr("disabled", "disabled");
		obj.val(wait + "秒后重新获取");
		wait--;
		setTimeout(function() {
			countdown(obj, msg)
		}, 1000)
	}
}
</script>
</body>
</html>